﻿@using Microsoft.Extensions.Localization
@using global::Localization.Resources.AbpUi
@using Microsoft.Extensions.Options
@using Volo.Abp.AspNetCore.Components.Web
@inherits AbpComponentBase
@inject IJSRuntime JsRuntime
@inject NavigationManager Navigation
@inject IStringLocalizer<AbpUiResource> UiLocalizer
@inject IOptions<AuthenticationOptions> AuthenticationOptions
@inject IOptions<AbpAspNetCoreComponentsWebOptions> AbpAspNetCoreComponentsWebOptions
<AuthorizeView>
    <Authorized>
        <Dropdown RightAligned="true">
            <DropdownToggle Color="Color.Default">
                @if (CurrentTenant.Name != null)
                {
                    <span><i>@CurrentTenant.Name</i>\@CurrentUser.UserName</span>
                }
                else
                {
                    <span>@CurrentUser.UserName</span>
                }
            </DropdownToggle>
            <DropdownMenu>
                @if (Menu != null)
                {
                    @foreach (var menuItem in Menu.Items)
                    {
                        <DropdownItem Clicked="@(() => NavigateToAsync(menuItem.Url, menuItem.Target))">@menuItem.DisplayName</DropdownItem>
                    }
                }
                <DropdownDivider />
                <DropdownItem Clicked="BeginSignOut">@UiLocalizer["Logout"]</DropdownItem>
            </DropdownMenu>
        </Dropdown>
    </Authorized>
    <NotAuthorized>
        <a class="nav-link" href="@AuthenticationOptions.Value.LoginUrl">@UiLocalizer["Login"]</a>
    </NotAuthorized>
</AuthorizeView>
